/* ==========================================
 * jORLib : a free Java OR library
 * ==========================================
 *
 * Project Info:  https://github.com/jkinable/jorlib
 * Project Creator:  Joris Kinable (https://github.com/jkinable)
 *
 * (C) Copyright 2015, by Joris Kinable and Contributors.
 *
 * This program and the accompanying materials are licensed under LGPLv2.1
 *
 */
/* -----------------
 * AbstractColumn.java
 * -----------------
 * (C) Copyright 2015, by Joris Kinable and Contributors.
 *
 * Original Author:  Joris Kinable
 * Contributor(s):   -
 *
 * $Id$
 *
 * Changes
 * -------
 *
 */
package org.jorlib.frameworks.columnGeneration.colgenMain;

import org.jorlib.frameworks.columnGeneration.pricing.AbstractPricingProblem;


/**
 * Abstract Class modeling a column in the column generation procedure.
 * Note that the fields in a column (except the value assigned to it by the master problem) are all final: a column should NOT be tempered with.
 * 
 * @author Joris Kinable
 * @version 13-4-2015
 *
 */
public abstract class AbstractColumn<T, V extends AbstractPricingProblem<T>>{
	/** The value of the column assigned to it by the last master problem solved which contained this node**/
	public double value;
	/** Indicates whether this is a real column generated by a pricing problem, or whether it has been generated to obtain an initial feasible solution.
	Optimal solutions may NOT contain artificial columns unless the problem is infeasible **/
	public final boolean isArtificialColumn;
	/** Textual description of the method which created this column, e.g a pricing problem, initial solution, artificial, etc.
	Used for debugging purposes only to determine where a column is coming from **/
	public final String creator;
	
	/** The pricing problem to which this column belongs **/
	public final V associatedPricingProblem;
	
	/**
	 * Constructs a new column
	 * @param associatedPricingProblem Pricing problem to which this column belongs
	 * @param isArtificial Is this an artificial column?
	 * @param creator Who/What created this column?
	 */
	public AbstractColumn(V associatedPricingProblem, boolean isArtificial, String creator){
		this.creator=creator;
		this.isArtificialColumn=isArtificial;
		this.associatedPricingProblem=associatedPricingProblem;
	}
	
	/**
	 * Compares two columns mutually.
	 */
	public abstract boolean equals(Object o);

	/**
	 * Creates a hashCode for the given column
	 */
	public abstract int hashCode();

	/**
	 * Gives a textual representation of a column
	 */
	public abstract String toString();

}
